package org.jeecg.modules.yc.web.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.yc.web.entity.PdDevice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 传感器
 * @Author: jeecg-boot
 * @Date:   2024-01-08
 * @Version: V1.0
 */
public interface PdDeviceMapper extends BaseMapper<PdDevice> {

    /**
     * 通过所属采集器和自身编号查询（自身编号可能会有重复需要加一个采集器条件）
     * @param deviceId
     * @param no
     * @return
     */
    public PdDevice queryByDeviceIdAndNo(@Param("deviceId")String deviceId, @Param("no")String no);

    @Select("<script>"
            + "SELECT count(id) FROM yc_pd_device WHERE terminal_id = #{terminalId, jdbcType=VARCHAR}  "
            + "</script>")
    Integer deviceCountByTerminalId(@Param("terminalId") String terminalId);
}
